package com.github.fork.api;

import com.github.fork.entity.Country;
import com.github.fork.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * @author Jerry Liu
 * @since 2017/3/25
 */
@Path("/demo")
public class DemoApi {

    @Autowired
    private CountryService countryService;

    @Path("/info/{code}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public Country info(@PathParam("code") String code) {

        System.out.println("Request =======" + code);
        return countryService.findOne(code);
    }
}
